package com.mi.system.dto.request;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.mi.common.core.jackson.LongArrayDeserializer;
import com.mi.common.core.validation.Save;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * 用户请求信息
 *
 * @author jin_huaquan
 * @version 1.0
 * @date 2021/11/3 15:21
 */
@ApiModel(value = "UserRequestDTO对象", description = "用户请求信息")
@Data
public class UserRequestDTO {

    @ApiModelProperty(value = "部门ID", dataType = "java.lang.String")
    private Long deptId;

    @ApiModelProperty(value = "账号", required = true)
    @NotBlank(groups = Save.class, message = "账号不能为空")
    @Length(groups = Save.class, min = 1, max = 32, message = "账号不能超过32个字符")
    private String username;

    @ApiModelProperty(value = "账号密码")
    @NotBlank(groups = Save.class, message = "账号密码不能为空")
    private String password;

    @ApiModelProperty("手机号")
    @Length(groups = Save.class, max = 15, message = "手机号不能超过15个字符")
    private String mobile;

    @ApiModelProperty(value = "关联的角色集合", required = true, dataType = "[Ljava.lang.String;")
    @NotEmpty(message = "角色ID不能为空")
    @JsonDeserialize(using = LongArrayDeserializer.class)
    private Long[] roleIds;

    @ApiModelProperty(value = "是否启用（0-禁用,1-启用）", required = true)
    @NotNull(message = "账号是否启用不能为空")
    private Integer enabled;

    @ApiModelProperty("备注")
    private String remarks;
}
